package com.yudaxian;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @Author: yudaxian
 * @Description: TODO
 * @DateTime: 2024/9/13 15:03
 **/
@SpringBootApplication
public class ConfirmConsumerApplication {


    public static void main(String[] args) {
        TestStaticNum testStaticNum1 = new TestStaticNum();
        testStaticNum1.setNum();
        System.out.println("静态变量，整个程序声明周期都存在，值为：" + TestStaticNum.staticNum);
        System.out.println("实例变量，只作用于当前实例，值为：" + testStaticNum1.normalNum);
        TestStaticNum testStaticNum2 = new TestStaticNum();
        System.out.println("静态变量，整个程序声明周期都存在，值为：" + TestStaticNum.staticNum);
        System.out.println("实例变量，只作用于当前实例，值为：" + testStaticNum2.normalNum);
//        SpringApplication.run(ConfirmConsumerApplication.class, args);
    }
}


class TestStaticNum {
    public static int staticNum = 0;
    public int normalNum = 0;

    public void  setNum() {
        staticNum++;
        normalNum++;
    }
}